The Model View Controller (MVC) Pattern is an architecture for designing software where the software may be designed as three distinct components: data model, view model and controller. The data model may be used to detail any data objects that may be used by the software under design. For example, the data model may determine how information is stored and utilized by the software under design. The view model may be used to establish a user interface. For example, the view model may provide a graphical interface that communicates information with the user. The controller may handle the functional logic of the software under design. For example, where the software under design is a business application, the controller may provide the business logic utilized to provide the functionality of the program.
The MVC provides multiple advantages. For example, MVC allows for separation of concerns. Separation of concerns is the ability for programmers or groups of programmers to each work on one of the distinct components of the software under design. For example, a programmer who has special skills relating to data modeling may program the data model, while a second programmer who has special skills relating to user interfaces may program the view model and a programmer who has special skills relating to business logic may program the controller.
Moreover, as revisions are made to the software under design, revisions may be made to a single component without damaging the other components. For example, user interface code may undergo frequent and often dramatic revision. Separating the view model from the rest of the software under design allows for the user interface to be more easily revised with less of a likelihood of damaging other aspects of the software in the process.
While MVC may be implemented on a large number of platforms, Jakarta Struts is a popular web oriented MVC implementation. Jakarta Struts, owned by the Apache Foundation, is an open-source framework for developing J2EE web applications. Jakarta Struts is more fully described at http://jakarta.apache.org/struts/ which is herein incorporated by reference.
The MVC components may be developed, for example, by manually programming. Manual programming may rely on one or more programmers to produce the code by hand. Manual programming can be tedious and repetitive and is therefore prone to error. Moreover, certain changes to one MVC component may necessitate changing the other components. Even a relatively trivial change to one component may necessitate an overhaul of all three components. For example, changing a data field from “Christian Name” to “First Name” in the data model may necessitate implementing a corresponding change in both the view model and the controller.
This problem may be particularly acute when designing web services programs. Web services are systems for providing particular functionality over a computer network, for example, the Internet. Many web services are accessible using a standard web browser and therefore provide platform-independent functionality to the user. Web services programs often utilize tightly defined data formats. These data formats may be defined by an XML schema document. The XML schema document may set out exactly how data is to be used in the program.
It is therefore advantageous to utilize tools to automatically generate as much of the MVC components as possible so that there will be reduced opportunity for introducing error when designing or modifying components.
Existing tools may be used to provide a degree of automated code generation from the XML schema documents. For example, Castor from castor.org and JAXB from sun.com provide for the automatic creation of JAVA classes from XML schema. These JAVA classes may then be used to provide programmers with an automated translation of XML data into data structures that can more easily be integrated into computer programs.
Other tools exist for constructing XML descriptions from existing server code. For example, Apache Axis and Microsoft .NET have this functionality. These platforms may create web service description language (WSDL) files from an existing server code base. However, these tools are not able to automatically generate server code from XML descriptions.
Therefore it is desirable to be able to automatically generate code, for example MVC components, from XML descriptions.